<%--
  Created by IntelliJ IDEA.
  User: 4S
  Date: 2021/11/5
  Time: 17:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<p>添加项目经历</p>
<table>
    <tr>
        <td>
            <div class="layui-inline">
                <label class="layui-form-label">项目名称</label>
                <div class="layui-input-inline">
                    <input type="text" id="name" class="layui-input" placeholder="请填写项目名称"
                           value="" style="width: 490px">
                </div>
            </div>
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">项目时间</label>
                    <div class="layui-inline" id="test-range">
                        <div class="layui-input-inline">
                            <input type="text" id="startTime" class="layui-input" placeholder="开始时间"
                                   value=""
                                   style="width: 213.4px">
                        </div>
                        <div class="layui-form-mid">-</div>
                        <div class="layui-input-inline">
                            <input type="text" id="endTime" class="layui-input" placeholder="结束时间"
                                   value=""
                                   style="width: 213.4px">
                        </div>
                    </div>
                </div>
            </div>

        </td>
    </tr>
    <tr>
        <td colspan="2">
            <div class="layui-inline">
                <label class="layui-form-label"> 项目链接 </label>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="link" placeholder="请填写项目链接" value=""
                           style="width: 490px">
                </div>
            </div>
        </td>

    <tr>
    <tr>
        <td colspan="2">
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">项目描述</label>
                <div class="layui-input-block">
                            <textarea name="desc" id="description" placeholder="请填写项目描述（不超过500字）"
                                      class="layui-textarea"></textarea>
                </div>
            </div>
        </td>
    </tr>
</table>
    <button class="button_save" id="button_project_save_${project.id}" onclick="project_save()">保存并更新</button>
    <button class="button_cancel" id="button_project_cancel">取消</button>
</body>
</html>
<script>
    function project_save(){
        let resumeId = $("#resumeId").val();
        // let projectId = $("#projectId").val();
        let name = $("#name").val();
        let startTime = $("#startTime").val();
        let endTime = $("#endTime").val();
        let link = $("#link").val();
        let description = $("#description").val();
        let param = "resumeId=" + resumeId + "&name=" + name + "&startTime=" + startTime
            + "&endTime=" + endTime + "&link=" + link + "&description=" + description;
        console.log(param);
        $.post('/hire/resume/project/insert', param, function (res) {
            if (res.code == '200') {
                $("#pro_info").load("/hire/resume/project_info", {id: resumeId});
                $("#pro_edit").hide();
                $("#pro_info").show();

            } else {
                layer.msg(res.msg);
            }
        })
    }
    $("#button_project_cancel").click(function () {
        let resumeId = $("#resumeId").val();
        $("#pro_info").load("/hire/resume/project_info", {id: resumeId});
        $("#pro_edit").hide();
        $("#pro_info").show();
    })
    layui.use('laydate', function () {
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#startTime' //指定元素

        });
    });
    layui.use('laydate', function () {
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#endTime' //指定元素

        });
    });
</script>